package com.cskaoyan.javase.oop2._1extends._9override._1basic;

/**
 * 方法覆盖语法测试
 * 引用只能决定方法访问的范围
 * 对象决定具体的调用结果
 *
 * @since 09:44
 * @author wuguidong@cskaoyan.onaliyun.com
 */
public class Demo {
    public static void main(String[] args) {
        Son s = new Son();
        s.method();

        Father fs = new Son();
        fs.method();
        // fs.test2();

        LittleSon ls = new LittleSon();
        ls.method();

        Father fls = new LittleSon();
        fls.method();
    }
}

class Father {
    public void test() {
        System.out.println("Father");
    }

    public void method() {
        test();
    }
}

class LittleSon extends Father{

}

class Son extends Father {
    public void test() {
        System.out.println("Son");
    }

    public void test2(){}
}